/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calculator.entities;

import java.util.Collection;
import java.util.List;
import java.util.Vector;

/**
 *
 * @author Dargor
 */
public class MyVector extends MathEntity implements IMathEntity{
    private List<Integer> _numbers;

    public MyVector(int size)
    {
        this._numbers = new Vector<Integer>(size);
    }

    public MyVector(Collection<Integer> numbers)
    {
        this._numbers = new Vector<Integer>(numbers.size());
        for(Integer element: numbers)
            this._numbers.add(element);
    }

    public IMathEntity add(IMathEntity a) {
        MyVector result=null;
        if(a instanceof IntegerNumber){
            result = new MyVector(this._numbers);
            result.addAtEveryPosition(((IntegerNumber)a).getValue());
        }

        return result;
        
    }

    public IMathEntity substract(IMathEntity a) {
        System.out.println("odejmowanie");
        return null;
    }

    public IMathEntity divide(IMathEntity a) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public IMathEntity multiply(IMathEntity a) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setAtPosition(int position, int value)
    {
        this._numbers.set(position, value);
    }

    private void addAtEveryPosition(int value)
    {
        for(int i=0; i < this._numbers.size(); i++)
        {
            int tmp = this._numbers.get(i);
            this.setAtPosition(i, value+tmp);
        }
    }

    public IntegerNumber parseIntegerNumber() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public MyVector parseMyVector() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public SuperBigNumber parseSuperBigNumber() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
